unit cmdCreateSession;

interface

uses  classes, sysutils
    , toolsGlobalId
    , appMappldXmlNode
    , appMappldXmlCommand
    , appMappldTypes
    , appMappldXmlContext
    , appMappldXmlSession
;

type
    {------------------------------ TCmdCreateSession }

    {***************************************************************************
    * TCmdCreateSession
    ***************************************************************************}
    TCmdCreateSession = class( TMappldXmlCommand )
protected
    procedure   internalProccess(); override;
    function    internalPrepareResult( aResultNode : TMappldXmlNode ) : boolean; override;

    end;

implementation

{*******************************************************************************
* internalProccess
*******************************************************************************}
procedure TCmdCreateSession.internalProccess();
//var
//    sessionId : string;

begin
{
    if ( Fsession = nil ) then
    begin
        sessionId := GetUniqueStr( 'c' );

        Fsession := TMappldXmlSession( Fsessions.createSession( sessionId ) );
        Fsessions[ sessionId ] := Fsession;
    end;}
end;

{*******************************************************************************
* internalPrepareResult
*******************************************************************************}
function TCmdCreateSession.internalPrepareResult( aResultNode : TMappldXmlNode ) : boolean;
begin
    aResultNode.ValueAsString := Fsession.sessionId;

    Result := true;
end;

{*******************************************************************************
* initialization
*******************************************************************************}
initialization

TMappldXmlCommand.registerCommandByCode( XML_CMD_CreateSession, TCmdCreateSession );

end.
